package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.IndexImgQueryClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-16 11:23
 */
@Slf4j
@Component
public class IndexQueryClientFallback implements FallbackFactory<IndexImgQueryClient>{
    @Override
    public IndexImgQueryClient create(Throwable cause) {
        log.warn("调用首页轮播图查询服务异常："+cause);
        return new IndexImgQueryClient(){
            @Override
            public Result retrieveCurrent() {
                return Result.internalServerError();
            }
        };
    }
}
